//
//  LoginBaseViewController.m
//  CarUser
//
//  Created by ayi on 2018/12/26.
//  Copyright © 2018 王森林. All rights reserved.
//

#import "LoginBaseViewController.h"

@interface LoginBaseViewController ()

@end

@implementation LoginBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view
    
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

    UIImageView *downBgimgv = [[UIImageView alloc]initWithImage:IMG(@"bg_my")];
    downBgimgv.backgroundColor = UIColor.blackColor;
    [self.view addSubview:downBgimgv];
    [self.view insertSubview:downBgimgv atIndex:0];
    [downBgimgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(IS_IPHONE_X?-NAV_HEIGHT:-64);
        (void)make.left.and.right.and.bottom;
    }];
    UIView *downBgview = [[UIView alloc]init];
    downBgview.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
    [self.view addSubview:downBgview];
    [self.view insertSubview:downBgview atIndex:1];
    [downBgview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(IS_IPHONE_X?-NAV_HEIGHT:-64);
        (void)make.left.and.right.and.bottom;
    }];
    
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[UIImage new]];
    //设置导航栏标题和返回键的颜色和字体
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor],NSFontAttributeName:[UIFont systemFontOfSize:18]}];
    [[UINavigationBar appearance] setTintColor:UIColor.whiteColor];
    self.edgesForExtendedLayout = UIRectEdgeNone;
    
    
    [self setLeftBcakBtn];
}

- (void)setLeftBcakBtn{
    if (self.navigationController.viewControllers.count > 1) {
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"nav_back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
    }
}

- (void)backAction{
    [self.view endEditing:YES];
    [self.navigationController popViewControllerAnimated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
